<?php
//dezend by http://www.yunlu99.com/ QQ:270656184
class CI_Benchmark
{
	/**
	 * List of all benchmark markers
	 *
	 * @var	array
	 */
	public $marker = array();

	public function mark($name)
	{
		$this->marker[$name] = microtime(true);
	}

	public function elapsed_time($point1 = '', $point2 = '', $decimals = 4)
	{
		if ($point1 === '') {
			return '{elapsed_time}';
		}

		if (!isset($this->marker[$point1])) {
			return '';
		}

		if (!isset($this->marker[$point2])) {
			$this->marker[$point2] = microtime(true);
		}

		return number_format($this->marker[$point2] - $this->marker[$point1], $decimals);
	}

	public function memory_usage()
	{
		return '{memory_usage}';
	}
}

defined('BASEPATH') || exit('No direct script access allowed');

?>
